package com.jprocms.module.cms.api.dto;

import com.mzt.logapi.starter.annotation.DiffLogField;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.lang.Nullable;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

@Data
public class EmailConfig implements Serializable {
    private static final long serialVersionUID = 1L;

    @Nullable
    @Length(max = 50)
    private String host = "smtp.qq.com";
    @Nullable
    private Integer port = 465;
    private boolean ssl = true;
    @Nullable
    private Integer timeout = 5000;
    @Length(max = 50)
    private String from = "username@email.com";
    @Length(max = 50)
    private String username = "username";
    @Length(max = 50)
    private String password = "password";
    /**
     * 验证码长度
     */
    @Min(4)
    @Max(6)
    @DiffLogField(name = "验证码长度")
    private int verificationCodeLength = 6;
    /**
     * 验证码过期时间。单位：分钟
     */
    @Min(3)
    @Max(30)
    @DiffLogField(name = "验证码过期时间")
    private Long verificationCodeExpires = 5L;
    @NotNull
    @Length(max = 100)
    @DiffLogField(name = "邮件主题")
    private String subject = "邮件验证码";
    @NotNull
    @Length(max = 400)
    @DiffLogField(name = "邮件内容")
    private String text = "验证码：${code}。如非本人操作，请忽略本邮件。";
    @Length(max = 50)
    private String testTo = "";

    /**
     * 单个邮箱验证码每日发送次数
     */
    @Min(1)
    @DiffLogField(name = "单个邮箱验证码每日发送次数")
    private int oneDayCodeSendMax = 10;

}
